package cn.afactory.tygz.net;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;

import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.ResponseStream;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.http.client.HttpRequest;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;

import cn.afactory.tygz.R;
import cn.afactory.tygz.common.AppDebug;
import cn.afactory.tygz.common.ErrorCode;
import cn.afactory.tygz.db.DBManager;
import cn.afactory.tygz.model.AdInfoList;
import cn.afactory.tygz.model.ApartmentInfoList;
import cn.afactory.tygz.model.BooleanResult;
import cn.afactory.tygz.model.CompanyInfoList;
import cn.afactory.tygz.model.EntertainmentInfoList;
import cn.afactory.tygz.model.ExchangeGoodInfoList;
import cn.afactory.tygz.model.LifeServiceInfoList;
import cn.afactory.tygz.model.MessageDetailList;
import cn.afactory.tygz.model.MoneyDetailList;
import cn.afactory.tygz.model.MoneyRecordList;
import cn.afactory.tygz.model.MoneyShopList;
import cn.afactory.tygz.model.NearByUserInfoList;
import cn.afactory.tygz.model.PrasizeResult;
import cn.afactory.tygz.model.PrivateUserInfoList;
import cn.afactory.tygz.model.RestaurantInfoList;
import cn.afactory.tygz.model.ScenicSpotsInfoList;
import cn.afactory.tygz.model.SecondGoodsInfoList;
import cn.afactory.tygz.model.ServiceTypeList;
import cn.afactory.tygz.model.SnsCommentInfoList;
import cn.afactory.tygz.model.SnsSubjectDetail;
import cn.afactory.tygz.model.SnsSubjectDetailList;
import cn.afactory.tygz.model.SnsTopicInfo;
import cn.afactory.tygz.model.SnsTopicInfoList;
import cn.afactory.tygz.model.SnsUserInfoList;
import cn.afactory.tygz.model.SysMessageItemList;
import cn.afactory.tygz.model.UploadFileInfo;
import cn.afactory.tygz.model.UploadFileInfoList;
import cn.afactory.tygz.model.UserInfo;
import cn.afactory.tygz.model.VersionInfo;
import cn.afactory.tygz.net.lsn.OnAbstractListener;
import cn.afactory.tygz.net.lsn.OnResponseListener;
import cn.afactory.tygz.ui.base.utils.HarwkinLogUtils;
import cn.afactory.tygz.ui.base.utils.MD5Utils;
import cn.afactory.tygz.ui.base.utils.NetworkUtil;
import cn.afactory.tygz.ui.base.utils.SPUtils;

/**
 * Created with Android Studio.
 * Title:NetManager
 * Description:
 * Copyright:Copyright (c) 2014
 * Company:中国平安健康保险有限公司
 * Author:Alice
 * Date:15/8/18
 * Time:下午1:44
 * Version 1.0
 */
public class NetManager {
    public static final boolean DEBUG = AppDebug.NET_DEBUG;
    public static String TAG = "NetManager";
    private static Context mContext;
    private static NetManager mInstance;
    private HttpUtils mHttpUtils;
    private Handler mHandler = new Handler(Looper.getMainLooper());

    NetManager(Context context) {
        mContext = context;
        mHttpUtils = new HttpUtils();
        mHttpUtils.configCurrentHttpCacheExpiry(0);
    }

    public static NetManager getInstance(Context context) {
        if (mInstance == null) {
            mInstance = new NetManager(context);
        }
        return mInstance;
    }

    /**
     * 检测条件是否允许提交请求
     *
     * @return
     */
    private boolean checkSubmitStatus(final OnAbstractListener lsn) {
        if (!NetworkUtil.isNetworkAvailable(mContext)) {
            mHandler.post(new Runnable() {

                @Override
                public void run() {
                    if (lsn != null) {
                        lsn.onInternError(ErrorCode.NETWORK_UNAVAILABLE,
                                mContext.getString(R.string.network_unavailable));
                    }
                }
            });
            return false;
        }
        return true;
    }

    /**
     * 请求动态验证码
     *
     * @param phoneNum
     * @param lsn
     */
    public void doRequestDynamicCode(final String phoneNum, final OnResponseListener<Boolean> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }

        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, phoneNum);
                    String url = String.format(Urls.URL_REQUEST_DYNAMIC_CODE, phoneNum, t, s);
                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 注册的接口
     *
     * @param phoneNum
     * @param dynamicCode
     * @param pwd
     * @param lsn
     */
    public void doRegister(final String phoneNum,
                           final String pwd,
                           final String dynamicCode,
                           final OnResponseListener<UserInfo> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, phoneNum + MD5Utils.toMD5(pwd));
                    String url = String.format(Urls.URL_REGISTER, phoneNum, MD5Utils.toMD5(pwd), dynamicCode, t, s);
                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            UserInfo value;
                            try {
                                value = UserInfo.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK && value != null && value.id > 0) {
                                    SPUtils.setMobilePhone(mContext, phoneNum);
                                    SPUtils.setUid(mContext, value.id);
                                    SPUtils.setAccessToken(mContext, value.accessToken);

                                    DBManager.getInstance(mContext).saveUserInfo(value);
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 登录的接口
     *
     * @param phoneNum
     * @param pwd
     */
    public void doLogin(final String phoneNum,
                        final String pwd,
                        final OnResponseListener<UserInfo> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }

        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, phoneNum + MD5Utils.toMD5(pwd));
                    String lat = SPUtils.getExtraCurrentLat(mContext);
                    String lng = SPUtils.getExtraCurrentLon(mContext);
                    String url = String.format(Urls.URL_LOGIN, phoneNum, MD5Utils.toMD5(pwd), t, s, lng, lat);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            UserInfo value;
                            try {
                                value = UserInfo.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK && value != null && value.id > 0) {
                                    SPUtils.setMobilePhone(mContext, phoneNum);
                                    SPUtils.setUid(mContext, value.id);
                                    SPUtils.setAccessToken(mContext, value.accessToken);

                                    DBManager.getInstance(mContext).saveUserInfo(value);
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 忘记密码的接口
     *
     * @param phoneNum
     * @param dynamicCode
     * @param pwd
     * @param lsn
     */
    public void doResetPwd(final String phoneNum,
                           final String pwd,
                           final String dynamicCode,
                           final OnResponseListener<Boolean> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, phoneNum + MD5Utils.toMD5(pwd));
                    String url = String.format(Urls.URL_RESET_PWD, phoneNum, MD5Utils.toMD5(pwd), dynamicCode, t, s);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 退出登录
     *
     * @param lsn
     */
    public void doLogout(final OnResponseListener<Boolean> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long userId = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_LOGOUT,token, t, s,userId);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 异步上传图片
     *
     * @param filePaths 图片本地的地址
     * @param lsn
     */
    public void doUploadImage(final String filePaths,
                              final String type,
                              final OnResponseListener<UploadFileInfoList> lsn) {
        doUploadFiles(filePaths, lsn, "image/jpeg", type);
    }

    /**
     * 批量上传图片
     * @param filePaths
     * @param type
     * @param lsn
     */
    public void doUploadImages(final List<String> filePaths,
                              final String type,
                              final OnResponseListener<UploadFileInfoList> lsn) {
        doUploadFiles(filePaths, lsn, "image/jpeg", type);
    }

    /**
     * 异步上传文件
     *
     * @param filePaths
     * @param lsn
     * @param mimeType
     * @prarm type head 表示头像，post 表示帖子  album 表示相册
     */
    private void doUploadFiles(final String filePaths,
                               final OnResponseListener<UploadFileInfoList> lsn,
                               final String mimeType,
                               final String type) {
        if (!checkSubmitStatus(lsn) || filePaths == null) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    final List<String> uploadFileNames = new ArrayList<String>();
                    final UploadFileInfoList uploadResult = uploadFilesInner(filePaths, null, mimeType, type);
                    if (uploadResult != null && uploadResult.data != null && uploadResult.data.size() > 0) {
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                if (lsn != null) {
                                    lsn.onComplete(true, uploadResult,
                                            ErrorCode.STATUS_OK, null);
                                }
                            }
                        });

                    } else {
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                if (lsn != null) {
                                    lsn.onComplete(false, null,
                                            ErrorCode.UPLOAD_PICTURE_FAILED,
                                            mContext.getString(R.string.picture_upload_failed));
                                }
                            }
                        });

                    }
                } catch (final Exception e) {
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 异步上传文件
     *
     * @param filePaths
     * @param lsn
     * @param mimeType
     * @prarm type head 表示头像，post 表示帖子  album 表示相册
     */
    private void doUploadFiles(final List<String> filePaths,
                               final OnResponseListener<UploadFileInfoList> lsn,
                               final String mimeType,
                               final String type) {
        if (!checkSubmitStatus(lsn) || filePaths == null) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    final List<String> uploadFileNames = new ArrayList<String>();
                    List<UploadFileInfo> uploadFileInfos = new ArrayList<>();
                    for(String path : filePaths){
                        final UploadFileInfoList uploadResult = uploadFilesInner(path, null, mimeType, type);
                        if(uploadResult != null && uploadResult.data != null && uploadResult.data.size() > 0){
                            uploadFileInfos.add(uploadResult.data.get(0));
                        }
                    }
                    if (uploadFileInfos.size() > 0) {
                        final UploadFileInfoList result = new UploadFileInfoList();
                        result.data = uploadFileInfos;
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                if (lsn != null) {
                                    lsn.onComplete(true, result,
                                            ErrorCode.STATUS_OK, null);
                                }
                            }
                        });

                    } else {
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                if (lsn != null) {
                                    lsn.onComplete(false, null,
                                            ErrorCode.UPLOAD_PICTURE_FAILED,
                                            mContext.getString(R.string.picture_upload_failed));
                                }
                            }
                        });

                    }
                } catch (final Exception e) {
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    private UploadFileInfoList uploadFilesInner(final String filePath,
                                  final OnResponseListener<String> lsn,
                                  final String mimeType,
                                  final String type) throws IOException, JSONException{
        RequestParams params = new RequestParams();
        params.addBodyParameter("uploadFiles", new File(filePath));
        params.addBodyParameter("type", type);
        params.addBodyParameter("noCheck", "1");

        try {
            ResponseStream responseStream = mHttpUtils.sendSync(HttpRequest.HttpMethod.POST,
                    Urls.URL_UPLOAD_FILES,
                    params);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            byte[] buf = new byte[1024];
            int length = -1;
            while ((length = responseStream.read(buf)) != -1) {
                baos.write(buf, 0, length);
            }
            final String result = baos.toString();
            UploadFileInfoList value = UploadFileInfoList.deserialize(result);
            if(value != null && value.state == ErrorCode.STATUS_OK){
                return value;
            }
        } catch (HttpException e) {
            e.printStackTrace();
        }
        return  null;
    }

    /**
     * 获取个人信息
     * @param userId
     * @param lsn
     */
    public void doGetUserInfo(
            final long userId,
            final OnResponseListener<UserInfo> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }

        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_USER_INFO,token,userId,t,s);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            UserInfo value;
                            try {
                                value = UserInfo.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK && value != null && value.id > 0) {
                                    if(SPUtils.isSelf(mContext,value.id)) {
                                        DBManager.getInstance(mContext).saveUserInfo(value);
                                    }
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 更新个人信息
     * @param headId
     * @param nickName
     * @param sex
     * @param cityCode
     * @param cityName
     * @param birthday
     * @param userStatus
     * @param sign
     * @param goal
     * @param locationCityCode
     * @param locationCityName
     * @param intro
     * @param lsn
     */
    public void doUpdateUserInfo(
                           final String headId,
                           final String nickName,
                           final int sex,
                           final String cityCode,
                           final String cityName,
                           final long birthday,
                           final String userStatus,
                           final String sign,
                           final String goal,
                           final String locationCityCode,
                           final String locationCityName,
                           final String intro,
                           final String companyName,
                           final OnResponseListener<UserInfo> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_UPDATE_USER_INFO,token,uid,t,s);
                    if(headId != null){
                        url = url + "&headId=" + headId;
                    }
                    if(nickName != null){
                        url = url + "&nickName=" + URLEncoder.encode(nickName);
                    }

                    if(sex > -1){
                        url = url + "&sex=" + sex;
                    }
                    if(cityCode != null ){
                        url = url + "&cityCode=" + URLEncoder.encode(cityCode);
                    }

                    if(cityName != null ){
                        url = url + "&cityName=" + URLEncoder.encode(cityName);
                    }

                    if(birthday != -1l){
                        url = url + "&birth=" + birthday;
                    }

                    if(userStatus != null ){
                        url = url + "&maritalStatus=" + userStatus;
                    }

                    if(sign != null ){
                        url = url + "&signature=" + URLEncoder.encode(sign);
                    }

                    if(goal != null ){
                        url = url + "&dest=" + URLEncoder.encode(goal);
                    }

                    if(locationCityCode != null ){
                        url = url + "&locationCityCode=" + URLEncoder.encode(locationCityCode);
                    }

                    if(locationCityName != null ){
                        url = url + "&locationCityName=" + URLEncoder.encode(locationCityName);
                    }

                    if(intro != null ){
                        url = url + "&intro=" + URLEncoder.encode(intro);
                    }

                    if(companyName != null ){
                        url = url + "&company=" + URLEncoder.encode(companyName);
                    }

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            UserInfo value;
                            try {
                                value = UserInfo.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    value.accessToken = SPUtils.getAccessToken(mContext);
                                    DBManager.getInstance(mContext).saveUserInfo(value);
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取话题列表
     * @param type 0关注 1创建
     */
    public void doGetTopicList(
            final long targetUserId,
            final int type,
            final int page,
            final int row,
            final OnResponseListener<SnsTopicInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
//                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_FOCUS_TOPIC_LIST,token,targetUserId,type,page,row,t,s);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            SnsTopicInfoList value;
                            try {
                                value = SnsTopicInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取附近的事的列表
     * @param pageIndex
     * @param pageSize
     * @param lsn
     */
    public void doGetNearByForumsList(
            final int pageIndex,
            final int pageSize,
            final OnResponseListener<SnsSubjectDetailList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String lng = SPUtils.getExtraCurrentLon(mContext);
                    String lat = SPUtils.getExtraCurrentLat(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_NEAR_BY_FORUMS,token,t,s,lng,lat,uid,pageIndex,pageSize);

                    HarwkinLogUtils.getInstance().info("Harwkin",System.currentTimeMillis() + " req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin",System.currentTimeMillis() +  " resp : " + responseInfo.result );
                            SnsSubjectDetailList value;
                            try {
                                value = SnsSubjectDetailList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取附近的人
     * @param sex
     * @param startAge
     * @param endAge
     * @param city
     * @param pageIndex
     * @param pageSize
     * @param lsn
     */
    public void doGetNearByPeoplesList(
            final int sex,
            final int startAge,
            final int endAge,
            final int city,
            final int pageIndex,
            final int pageSize,
            final OnResponseListener<NearByUserInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String lng = SPUtils.getExtraCurrentLon(mContext);
                    String lat = SPUtils.getExtraCurrentLat(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_NEAR_BY_PEOPLE, token, t, s,uid,lng, lat, pageIndex, pageSize);
                    if(sex > -1){
                        url = url + "&queryProxy[sex]=" + sex;
                    }

                    if(startAge > -1){
                        url = url + "&queryProxy[startAge]=" + startAge;
                    }

                    if(endAge > -1){
                        url = url + "&queryProxy[endAge]=" + endAge;
                    }

                    if(city > -1){
                        url = url + "&queryProxy[city]=" + city;
                    }
                    HarwkinLogUtils.getInstance().info("Harwkin", System.currentTimeMillis() + " req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin",System.currentTimeMillis() +  " resp : " + responseInfo.result );
                            NearByUserInfoList value;
                            try {
                                value = NearByUserInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 点赞
     * @param postId
     * @param lsn
     */
    public void doPrasize(
            final long postId,
            final OnResponseListener<PrasizeResult> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_FORUM_PRASIZE, token, uid, postId, t, s);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            PrasizeResult value;
                            try {
                                value = PrasizeResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }


    /**
     * 发帖子
     * @param content
     * @param channelId
     * @param fileIds
     * @param lsn
     */
    public void doPublishForum(
            final String content,
            final long channelId,
            final int fileIds,
            final OnResponseListener<Boolean> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String lng = SPUtils.getExtraCurrentLon(mContext);
                    String lat = SPUtils.getExtraCurrentLat(mContext);
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_PUBLISH_FORUM, token,t,s,uid, URLEncoder.encode(content));
                    if(channelId > -1){
                        url = url + "&channelId=" + channelId;
                    }

                    if(fileIds > 0){
                        url = url + "&fileIds=" + fileIds;
                    }

                    if(lng != null){
                        url = url + "&lng=" + lng;
                    }

                    if(lat != null){
                        url = url + "&lat=" + lat;
                    }

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取点赞列表
     * @param postId
     * @param page
     * @param row
     * @param lsn
     */
    public void doGetPrasizeUserList(
            final long postId ,
            final int page ,
            final int row,
            final OnResponseListener<SnsUserInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_PRASIZE_LIST, uid,token,postId, page, row, t, s);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            SnsUserInfoList value;
                            try {
                                value = SnsUserInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 给帖子评论
     * @param postId
     * @param content
     * @param lsn
     */
    public void doPostComment(
            final long postId ,
            final String content,
            final OnResponseListener<Boolean> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_POST_COMMENT, token ,t, s,uid,postId,URLEncoder.encode(content));

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取评论列表
     * @param postId
     * @param page
     * @param row
     * @param lsn
     */
    public void doGetCommentList(
            final long postId ,
            final int page ,
            final int row,
            final OnResponseListener<SnsCommentInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_COMMENT_LIST, token, postId, page, row, t, s);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            SnsCommentInfoList value;
                            try {
                                value = SnsCommentInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 上传相册
     * @param fileIds
     * @param lsn
     */
    public void doUploadAlbum(
            final String fileIds,
            final OnResponseListener<Boolean> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_UPLOAD_ALBUM, token ,uid,URLEncoder.encode(fileIds),t, s);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 删除文件
     * @param fileId
     * @param lsn
     */
    public void doDeleteFile(
            final String fileId,
            final OnResponseListener<Boolean> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_DELETE_FILE, token ,t, s,fileId);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }


    /**
     * 获取个人相册
     * @param lsn
     */
    public void doGetAlbums(
            final long userId,
            final OnResponseListener<UploadFileInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_ALBUMS, token ,userId,t, s);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            UploadFileInfoList value;
                            try {
                                value = UploadFileInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取帖子详情
     * @param lsn
     */
    public void doGetForumDetail(
            final long postId ,
            final OnResponseListener<SnsSubjectDetail> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_FORUM_DETAIL, token , t, s,uid,postId);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            SnsSubjectDetail value;
                            try {
                                value = SnsSubjectDetail.deserializeDetail(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 发送私信
     * @param lsn
     */
    public void doSendMsg(
            final long receiveId,
            final String content,
            final OnResponseListener<Boolean> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long sendId = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_SEND_MSG, token ,receiveId,sendId,URLEncoder.encode(content),t, s);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 关注和取消关注用户
     * @param focusUserId
     * @param type  (0 是关注，1是取消关注)
     * @param lsn
     */
    public void doFocusUser(
            final long focusUserId,
            final int type,
            final OnResponseListener<Boolean> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_FOCUS_USER, token ,t, s,focusUserId,uid,type);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 关注和取消关注话题
     * @param topicId
     * @param type (0 是关注，1是取消关注)
     * @param lsn
     */
    public void doFocusTopic(
            final long topicId,
            final int type,
            final OnResponseListener<Boolean> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_FOCUS_TOPIC, token ,t, s,topicId,uid,type);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 拉黑用户
     * @param blackUserId
     * @param type (0 是拉黑，1是解除拉黑)
     * @param lsn
     */
    public void doBlackUser(
            final long blackUserId,
            final int type,
            final OnResponseListener<Boolean> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_BLACK_USER, token ,t, s,blackUserId,uid,type);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取拉黑列表
     * @param page
     * @param row
     * @param lsn
     */
    public void doGetBlackList(
            final int page ,
            final int row,
            final OnResponseListener<SnsUserInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_BLACK_LIST, token ,t, s,uid,page,row);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            SnsUserInfoList value;
                            try {
                                value = SnsUserInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取私信详情列表
     * @param page
     * @param row
     * @param lsn
     */
    public void doGetPrivateMsgList(
            final long toUserId,
            final int page ,
            final int row,
            final long addTime,
            final OnResponseListener<MessageDetailList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_PRIVATE_MSG_LIST, token ,t, s,uid,toUserId,page,row,addTime);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            MessageDetailList value;
                            try {
                                value = MessageDetailList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取系统消息列表
     * @param page
     * @param row
     * @param lsn
     */
    public void doGetSysMsgList(
            final int page ,
            final int row,
            final long addTime,
            final OnResponseListener<SysMessageItemList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_SYS_MSG_LIST, token ,t, s,uid,page,row,addTime);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            SysMessageItemList value;
                            try {
                                value = SysMessageItemList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取私信用户的列表
     * @param page
     * @param row
     * @param addTime
     * @param lsn
     */
    public void doGetPrivateUserList(
            final int page ,
            final int row,
            final long addTime,
            final OnResponseListener<PrivateUserInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_PRIVATE_LIST, token ,t, s,uid,page,row,addTime);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            PrivateUserInfoList value;
                            try {
                                value = PrivateUserInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }
    /**
     * 获取我的好友
     * @param page
     * @param row
     * @param type 0是关注1是粉丝
     * @param lsn
     */
    public void doGetFriendsList(
            final long userId,
            final int page ,
            final int row,
            final int type,
            final OnResponseListener<SnsUserInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_FRIENDS_LIST, token ,t, s,userId,type,page,row);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            SnsUserInfoList value;
                            try {
                                value = SnsUserInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取我参与的帖子列表
     * @param page
     * @param row
     * @param lsn
     */
    public void doGetMyJoinedForumSList(
            final long targetUserId,
            final int page ,
            final int row,
            final OnResponseListener<SnsSubjectDetailList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_MY_JOINED_FORUMS_LIST, token, t, s, targetUserId, page, row);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            SnsSubjectDetailList value;
                            try {
                                value = SnsSubjectDetailList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }
    //**************************************社区接口******************************//
    /**
     * 获取餐饮列表
     */
    public void doGetFoodsList(
            final double lat,
            final double lng,
            final int page ,
            final int row,
            final OnResponseListener<RestaurantInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_FOOD_LIST, token ,t, s,lat,lng,page,row);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            RestaurantInfoList value;
                            try {
                                value = RestaurantInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取公寓列表
     * @param lat
     * @param lng
     * @param page
     * @param row
     * @param lsn
     */
    public void doGetRoomList(
            final double lat,
            final double lng,
            final int page ,
            final int row,
            final OnResponseListener<ApartmentInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_ROOM_LIST, token ,t, s,lat,lng,page,row);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            ApartmentInfoList value;
                            try {
                                value = ApartmentInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取娱乐场所列表
     * @param lat
     * @param lng
     * @param typeId
     * @param page
     * @param row
     * @param lsn
     */
    public void doGetFuckList(
            final double lat,
            final double lng,
            final int typeId,
            final int page ,
            final int row,
            final OnResponseListener<EntertainmentInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_FUCK_LIST, token ,t, s,lat,lng,typeId,page,row);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            EntertainmentInfoList value;
                            try {
                                value = EntertainmentInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取周边景点信息
     * @param lat
     * @param lng
     * @param typeId
     * @param page
     * @param row
     * @param lsn
     */
    public void doGetSpotList(
            final double lat,
            final double lng,
            final int typeId,
            final int page ,
            final int row,
            final OnResponseListener<ScenicSpotsInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_SPOT_LIST, token ,t, s,lat,lng,typeId,page,row);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            ScenicSpotsInfoList value;
                            try {
                                value = ScenicSpotsInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取生活服务列表
     * @param lat
     * @param lng
     * @param typeId
     * @param page
     * @param row
     * @param lsn
     */
    public void doGetServiceList(
            final double lat,
            final double lng,
            final int typeId,
            final int page ,
            final int row,
            final OnResponseListener<LifeServiceInfoList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_SERVICE_LIST, token, t, s, lat, lng, typeId, page, row);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            LifeServiceInfoList value;
                            try {
                                value = LifeServiceInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 二手物品列表
     * @param lat
     * @param lng
     * @param typeId
     * @param page
     * @param row
     * @param sort
     * @param lsn
     */
    public void doGetSecondsList(
            final double lat,
            final double lng,
            final int typeId,
            final int page ,
            final int row,
            final int sort,
            final OnResponseListener<SecondGoodsInfoList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_SECONDS_LIST, token, t, s, lat, lng, typeId, sort,page, row);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            SecondGoodsInfoList value;
                            try {
                                value = SecondGoodsInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取服务类型
     * @param type (0 表示 娱乐场所类型  1 表示生活服务类型  2 表示 二手物品类型)
     * @param page
     * @param row
     * @param lsn
     */
    public void doGetServiceTypeList(
            final int type,
            final int page ,
            final int row,
            final OnResponseListener<ServiceTypeList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_SERVICE_TYPE, token, t, s ,page, row,type);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            ServiceTypeList value;
                            try {
                                value = ServiceTypeList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 搜索话题列表
     * @param keyword
     * @param page
     * @param row
     * @param lsn
     */
    public void doSearchTopic(
            final String keyword,
            final int page ,
            final int row,
            final OnResponseListener<SnsTopicInfoList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_SEARCH_TOPIC, token, t, s ,page, row,keyword);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            SnsTopicInfoList value;
                            try {
                                value = SnsTopicInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 搜索公司
     * @param keyword
     * @param page
     * @param row
     * @param lsn
     */
    public void doSearchCompany(
            final String keyword,
            final int page ,
            final int row,
            final OnResponseListener<CompanyInfoList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_SEARCH_COMPANY, token, t, s ,page, row,keyword);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            CompanyInfoList value;
                            try {
                                value = CompanyInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取话题详情
     * @param topicId
     * @param page
     * @param row
     * @param lsn
     */
    public void doTopicDetail(
            final long topicId,
            final OnResponseListener<SnsTopicInfo> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_TOPIC_DETAIL, token, t, s ,topicId);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            SnsTopicInfo value;
                            try {
                                value = SnsTopicInfo.deserializeData(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取我发布的二手物品列表
     * @param userId
     * @param page
     * @param row
     * @param lsn
     */
    public void doGetMyPublishSecondGoodsList(
            final long userId,
            final int page ,
            final int row,
            final OnResponseListener<SecondGoodsInfoList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_MY_PUBLISH_SECOND_GOODS_LIST, token, t, s ,userId,page, row);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            SecondGoodsInfoList value;
                            try {
                                value = SecondGoodsInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 发布二手物品
     * @param name
     * @param price
     * @param typeId
     * @param tel
     * @param adderss
     * @param intro
     * @param fileId
     * @param old 1  代表 95新2  代表 9成新3   代表  8成新4  代表  7成新以下
     * @param lsn
     */
    public void doPublishSecondGoods(
            final String name,
            final String price,
            final String typeId,
            final String tel,
            final String adderss,
            final String intro,
            final String old,
            final String fileId,
            final OnResponseListener<Boolean> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String lng = SPUtils.getExtraCurrentLon(mContext);
                    String lat = SPUtils.getExtraCurrentLat(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_PUBLISH_SECONDS, token, t, s ,uid,lat,lng,
                            URLEncoder.encode(name),
                            URLEncoder.encode(price),
                            URLEncoder.encode(typeId),
                            URLEncoder.encode(tel),
                            URLEncoder.encode(adderss),
                            URLEncoder.encode(intro),
                            URLEncoder.encode(old),
                            URLEncoder.encode(fileId));

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取商品兑换列表
     * @param pageIndex
     * @param pageSize
     * @param lsn
     */
    public void doGetExchangeList(
            final int pageIndex,
            final int pageSize,
            final OnResponseListener<ExchangeGoodInfoList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_EXCHANGE_GOODS_LIST, token, t, s ,pageIndex,pageSize);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            ExchangeGoodInfoList value;
                            try {
                                value = ExchangeGoodInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 工钱明细列表
     * @param pageIndex
     * @param pageSize
     * @param lsn
     */
    public void doGetMoneyPaidList(
            final int pageIndex,
            final int pageSize,
            final OnResponseListener<ExchangeGoodInfoList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_MONEY_PAIED_LIST, token, t, s ,pageIndex,pageSize);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            ExchangeGoodInfoList value;
                            try {
                                value = ExchangeGoodInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 兑换记录接口
     * @param pageIndex
     * @param pageSize
     * @param lsn
     */
    public void doGetExhangeRecordList(
            final int pageIndex,
            final int pageSize,
            final OnResponseListener<ExchangeGoodInfoList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_EXCHANGE_RECORD_LIST, token, t, s ,pageIndex,pageSize);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            ExchangeGoodInfoList value;
                            try {
                                value = ExchangeGoodInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取金币的列表接口
     * @param pageIndex
     * @param pageSize
     * @param lsn
     */
    public void doGetMoneyList(
            final int pageIndex,
            final int pageSize,
            final OnResponseListener<ExchangeGoodInfoList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_MONET_LIST, token, t, s ,pageIndex,pageSize);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            ExchangeGoodInfoList value;
                            try {
                                value = ExchangeGoodInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 检查版本
     * @param lsn
     */
    public void doCheckAppVersion(
            final OnResponseListener<VersionInfo> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
            try {
                String token = SPUtils.getAccessToken(mContext);
                String t = String.valueOf(System.currentTimeMillis());
                String s = SignUtil.createSignature(t, token);
                String url = String.format(Urls.URL_CHECK_APP_VERSION, token, t, s );

                HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                    @Override
                    public void onSuccess(ResponseInfo<String> responseInfo) {
                        HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                        VersionInfo value;
                        try {
                            value = VersionInfo.deserialize(responseInfo.result);
                            if (value != null && value.state == ErrorCode.STATUS_OK) {
                                if (lsn != null) {
                                    lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                }
                            } else {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                }
                            }
                        } catch (JSONException e) {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                            e.printStackTrace();
                        }
                    }

                    @Override
                    public void onFailure(HttpException error, String msg) {
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                            }
                        });
                    }
                });
            } catch (final Exception e) {
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        if (lsn != null) {
                            lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                        }
                    }
                });
                e.printStackTrace();
            }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取话题详情帖子列表
     * @param lsn
     */
    public void doGetCommentListByTopicId(
            final long topicId,
            final int pageIndex,
            final int pageSize,
            final OnResponseListener<SnsSubjectDetailList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_COMMENT_LIST_BY_TOPIC_ID, token, t, s ,topicId,pageIndex,pageSize);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            SnsSubjectDetailList value;
                            try {
                                value = SnsSubjectDetailList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取广告
     * @param type (0 表示 splash 广告  1 表示 社区的广告  )
     * @param lsn
     */
    public void doGetAd(
            final int type ,
            final OnResponseListener<AdInfoList> lsn) {
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_AD, token, t, s,type);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            AdInfoList value;
                            try {
                                value = AdInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取兑换商品列表
     */
    public void doGetMoneyShop(final OnResponseListener<MoneyShopList> lsn){
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_SHOP, token, t, s);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            MoneyShopList value;
                            try {
                                value = MoneyShopList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 给社区评论
     * @param postId
     * @param content
     * @param type (六类评论  类型 1代表二手物品 2代表餐饮 3代表房间 4代表娱乐场所 5代表周边景点 6代表生活服务）
     * @param lsn
     */
    public void doPostCommComment(
            final long postId ,
            final String content,
            final int type,
            final OnResponseListener<Boolean> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_POST_COMM_COMMENT, token ,t, s,uid,postId,
                            URLEncoder.encode(content),type);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取社区评论列表
     * @param postId
     * @param page
     * @param row
     * @param type (六类评论  类型 1代表二手物品 2代表餐饮 3代表房间 4代表娱乐场所 5代表周边景点 6代表生活服务）
     * @param lsn
     */
    public void doGetCommCommentList(
            final long postId ,
            final int page ,
            final int row,
            final int type,
            final OnResponseListener<SnsCommentInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_COMM_COMMENT_LIST, token, t,s,postId, page, row, type);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            SnsCommentInfoList value;
                            try {
                                value = SnsCommentInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    //兑换商品
    public void doGetExchange(final long userId,final int itemId ,final OnResponseListener<Integer> lsn){
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_EXCHANGE, token, t, s,userId,itemId);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            try {
                                JSONObject obj = new JSONObject(responseInfo.result);
                                int state = obj.getInt("state");
                                int value = obj.getJSONObject("data").getInt("value");
                                String message  = obj.getString("message");
                                if (state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, message);
                                    }
                                }
                            } catch (Exception e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 创建话题
     * @param topicName
     * @param topicDes
     * @param lsn
     */
    public void doCreateTopic(
            final String topicName,
            final String topicDes,
            final OnResponseListener<Boolean> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_CREATE_TOPIC, token ,t, s,uid,URLEncoder.encode(topicName),
                            URLEncoder.encode(topicDes));

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            BooleanResult value;
                            try {
                                value = BooleanResult.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, true, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, false, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    //兑换记录

    public void doGetMoneyRecord(final long userId,final int rows,final int page,final OnResponseListener<MoneyRecordList> lsn){
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_RECORD, token, t, s,userId,rows,page);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            MoneyRecordList value;
                            try {
                                value = MoneyRecordList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }
    public void doGetMoneyDetail(final long userId,final int rows,final int page,final OnResponseListener<MoneyDetailList> lsn){
        if (!checkSubmitStatus(lsn)) {
            return;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_DETAIL, token, t, s,userId,rows,page);

                    HarwkinLogUtils.getInstance().info("Harwkin", "req : " + url);
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin", "resp : " + responseInfo.result);
                            MoneyDetailList value;
                            try {
                                value = MoneyDetailList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }

    /**
     * 获取公司员工名字
     * @param companyName
     * @param lsn
     */
    public void doGetCompanyUserList(
            final long companyId,
            final int mPageIndex,
            final int mPageSize,
            final OnResponseListener<SnsUserInfoList> lsn){
        if(!checkSubmitStatus(lsn)){
            return ;
        }
        Runnable requestThread = new Runnable() {
            @Override
            public void run() {
                try {
                    long uid = SPUtils.getUid(mContext);
                    String token = SPUtils.getAccessToken(mContext);
                    String t = String.valueOf(System.currentTimeMillis());
                    String s = SignUtil.createSignature(t, token);
                    String url = String.format(Urls.URL_GET_COMPANY_LIST, token ,t, s,uid,companyId,mPageSize,mPageIndex);

                    HarwkinLogUtils.getInstance().info("Harwkin","req : " + url );
                    mHttpUtils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
                        @Override
                        public void onSuccess(ResponseInfo<String> responseInfo) {
                            HarwkinLogUtils.getInstance().info("Harwkin","resp : " + responseInfo.result );
                            SnsUserInfoList value;
                            try {
                                value = SnsUserInfoList.deserialize(responseInfo.result);
                                if (value.state == ErrorCode.STATUS_OK) {
                                    if (lsn != null) {
                                        lsn.onComplete(true, value, ErrorCode.STATUS_OK, null);
                                    }
                                } else {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, value.message);
                                    }
                                }
                            } catch (JSONException e) {
                                if (lsn != null) {
                                    lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                }
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onFailure(HttpException error, String msg) {
                            mHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    if (lsn != null) {
                                        lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                                    }
                                }
                            });
                        }
                    });
                } catch (final Exception e) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (lsn != null) {
                                lsn.onComplete(false, null, ErrorCode.STATUS_IO_EXCEPTION, null);
                            }
                        }
                    });
                    e.printStackTrace();
                }
            }
        };
        NetThreadManager.getInstance().execute(requestThread);
    }
}
